//package com.szjz.tool.release.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
//@Configuration
//public class RedisConfig {
//
//    @Bean(name = "redisTemplate")
//    public RedisTemplate<String, Object> getRedisTemplate(RedisConnectionFactory factory) {
//
//        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
//        redisTemplate.setConnectionFactory(factory);
//        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
//        RedisKeySerializer redisKeySerializer = new RedisKeySerializer();
//        redisTemplate.setKeySerializer(redisKeySerializer); // key的序列化类型
//        redisTemplate.setHashKeySerializer(redisKeySerializer);
//
//        //GenericFastJsonRedisSerializer genericFastJsonRedisSerializer = new GenericFastJsonRedisSerializer();
//      //  redisTemplate.setValueSerializer(genericFastJsonRedisSerializer); // value的序列化类型
//      //  redisTemplate.setHashValueSerializer(genericFastJsonRedisSerializer);
//        redisTemplate.afterPropertiesSet();
//        return redisTemplate;
//    }
//
//    public RedisConfig(){
//        System.out.println("=================== redis init ... ");
//    }
//}
